<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <title>易办公</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script src="/js/jquery-3.6.0.js"></script>
    <link rel="stylesheet" href="/lib/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/ZhiWeiQuanXian/ZhiWeiQuanXian.css">
    <script src="/lib/layui/layui.js" charset="utf-8"></script>
    <!--弹出层的js-->
    <script src="/js/smj-ZhiWeiQuanXian2.js" charset="utf-8"></script>
</head>

<body>

<input type="hidden" th:value="${quanxianinfos.pages}" id="pages">
<input type="hidden" th:value="${quanxianinfos.pageNum}" id="pageNum">

<table style="background-color: white ;height: 50px;width: 100%">
    <tr>
        <td align="center" >
            <h2>[ 职位权限细化 ]</h2>
        </td>

    </tr>
</table>
<table class="layui-table"
       lay-data="{}"
       lay-filter="demo">

    <thead>
    <tr>
        <td lay-data="{field:'id1', sort: true, width:'20%',align:'center'}">序号</td>
        <td lay-data="{field:'id2',width:'20%',align:'center'}">权限名称</td>
        <td lay-data="{field:'name1',width:'30%',align:'center'}">权限地址</td>
        <td lay-data="{field:'cz1',width:'30%',align:'center'}">操作</td>
    </tr>
    <!--    <div id="demo5"></div>-->
    </thead>
    <tr th:each=" qxif:${quanxianinfos.list}">
        <td th:text="${qxif.getId()}">11</td>
        <td th:text="${qxif.getAuth()}">11</td>
        <td th:text="${qxif.getPath()}">11</td>
        <td>
            <button type="button" class="layui-btn layui-btn-xs layui-btn-normal"
                    th:onclick="aaa([[${qxif.getId()}]],[[${qxif.getAuth()}]],[[${qxif.getPath()}]])">修改信息
            </button>
            <button type="button" class="layui-btn layui-btn-sm layui-btn-danger" th:onclick="bbb([[${qxif.getId()}]])">
                删除
            </button>
        </td>
    </tr>

</table>
<br>

<div style="text-align: center;">
    <button class="layui-btn layui-btn-warm layui-btn-sm" onclick="add()">增加权限</button>

    <a href="javascript:void(0)" type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-bg-green"
       onclick="start()">
        首页
    </a>
    <a type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-bg-green " onclick="prev()">
        <i class="layui-icon layui-icon-left "></i>
    </a>
    <a type="button" class="layui-btn layui-btn-sm layui-btn-primary ">
        <span><b class="yeshu">第1页 / 共1页</b></span>
    </a>
    <a type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-bg-green" onclick="next()">
        <i class="layui-icon layui-icon-right "></i>
    </a>
    <a href="javascript:void(0)" type="button" class="layui-btn layui-btn-sm layui-btn-primary layui-bg-green"
       onclick="end()">
        尾页
    </a>
</div>

<br>


</body>


<script>
    var pages = $("#pages").val();
    var pageNum = $("#pageNum").val();
    var currentPage = parseInt(pageNum);
    var pageSize = 10;
    var sumPage = parseInt(pages);
    $(".yeshu").text("第" + currentPage + "页 / 共" + sumPage + "页")

    function showPage() {
        location.href = "/zwqx/zw2?currentPage=" + currentPage + "&pageSize=" + pageSize
    }

    function next() {
        currentPage = currentPage + 1;
        console.log(currentPage + "----------currentPage")
        if (currentPage > sumPage) {
            currentPage = sumPage;
            layer.msg("最后一页啦")
            return;
        }
        showPage();
    }

    function prev() {
        currentPage = currentPage - 1;
        if (currentPage < 1) {
            currentPage = 1;
            layer.msg("前面没有啦")
            return;
        }
        showPage();
    }

    function end() {
        currentPage = sumPage

        showPage();

    }

    function start() {
        currentPage = 1

        showPage();

    }

</script>
</html>